package service.impl;

import dao.LabelDao;
import dao.impl.LabelDaoImpl;
import pojo.Label;
import service.LabelService;

import java.sql.SQLException;
import java.util.ArrayList;

public class LabelServiceImpl implements LabelService {
    private LabelDao labelDao = new LabelDaoImpl();
    private boolean flag = false;


    public ArrayList<Label> allLabels() throws SQLException, ClassNotFoundException {
        ArrayList<Label> allLabels = labelDao.allLabels();
        return allLabels;
    }


    public Integer findLabelLid(String label) throws SQLException {
        Integer lid = 0;
        lid = labelDao.findLabelLid(label);
        return lid;
    }


    public boolean addUserLabel(String label) throws SQLException {
        flag = labelDao.addUserLabel(label);
        return flag;
    }


    public boolean labelIsExist(String label) throws SQLException {
        flag = labelDao.labelIsExist(label);
        return flag;
    }


    public String findLabelById(Integer lid) throws SQLException {
        String label = null;
        label = labelDao.findLabelByid(lid);
        return label;
    }

}
